using System.Collections.Generic;
using System.Linq;
using IRepository;
using IServices;
using Jil;
using SqlSugar;
using YL.Core.Dto;
using YL.Core.Entity;
using YL.Utils.Extensions;
using YL.Utils.Table;

namespace Services
{
    public class Whr_notification_categroyServices : BaseServices<Whr_notification_category>, IWhr_notification_categoryServices
    {
        private readonly SqlSugarClient _client;

        private readonly IWhr_notification_categoryRepository _notification_categroy_Repository;

        public Whr_notification_categroyServices(SqlSugarClient client, IWhr_notification_categoryRepository repository) : base(repository)
        {
            _client = client;
            _notification_categroy_Repository = repository;
        }

        public List<WhrNotificationCategory> GetAll(int ifPatriarch = 0, int ifTeacher = 0, int ifAdmin = 0)
        {
            List<WhrNotificationCategory> list = _client.Queryable<Whr_notification_category>()
                .Where(c => c.IfPatriarch == ifPatriarch && c.IfTeacher == ifTeacher && c.IfAdmin == ifAdmin)
                .Select(c=> new WhrNotificationCategory
                {
                    categoryId = c.CategoryId,
                    name = c.Name,
                })
                .ToList();
            return list;
        }

    }
}